Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

The snippets API was failing due to improper URL encoding of the filename parameter #1878

Merged
merged 1 commit into from
Feb 10, 2024
Merged

The snippets API was failing due to improper URL encoding of the filename parameter #1878

merged 1 commit into from
Feb 10, 2024

Conversation

Sild
Copy link

@Sild Sild commented Feb 7, 2024

GitLab api error:

GET https://gitlab.ZZZ.com/api/v4/snippets/YYY/files/HEAD/version 1/raw: 404 {message: 404 File Not Found}'

Root Cause:

The filename contains spaces which need to be properly encoded in the URL path. url.QueryEscape was being used instead of PathEscape.

Resolution:

Use PathEscape when encoding the filename since it is part of the URL path rather than query parameters. After applying this change, the snippets API works correctly.

Please let me know if you have any other questions!

Copy link
Member

@svanharmelen svanharmelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍🏻

@svanharmelen svanharmelen merged commit b61ed28 into xanzy:main Feb 10, 2024
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants